import request from '@/utils/request'

// 查询运单信息列表
export function listWaybill(query) {
  return request({
    url: '/waybills/waybill/list',
    method: 'get',
    params: query
  })
}

// 查询运单信息详细
export function getWaybill(wayBillId) {
  return request({
    url: '/waybills/waybill/' + wayBillId,
    method: 'get'
  })
}

// 新增运单信息
export function addWaybill(data) {
  return request({
    url: '/waybills/waybill',
    method: 'post',
    data: data
  })
}

// 修改运单信息
export function updateWaybill(data) {
  return request({
    url: '/waybills/waybill',
    method: 'put',
    data: data
  })
}

// 删除运单信息
export function delWaybill(wayBillId) {
  return request({
    url: '/waybills/waybill/' + wayBillId,
    method: 'delete'
  })
}

// 货物信息
export function calculateGoodTotalWeight(data) {
  return request({
    url: '/waybills/waybill/calculate',
    method: 'put',
    data: data
  })
}

// 查询运单信息详细，按月利润单ID，月利润表，关联运单显示，使用
export function listWaybillByMonthProfitBillId(monthProfitBillId, query) {
  return request({
    url: '/waybills/waybill/monthprofitstatistic/' + monthProfitBillId,
    method: 'get',
    params: query
  })
}

// 批量新增运单信息，通过出库单ID
export function addWaybillByExitIds(exitWarehouseIds, data) {
  return request({
    url: '/waybills/waybill/exitWarehouse/' + exitWarehouseIds,
    method: 'post',
    data: data
  })
}

// 批量新增回程运单，通过运单ID
export function addWaybillByWaybillIds(waybillIds, data) {
  return request({
    url: '/waybills/waybill/upwardwaybill/' + waybillIds,
    method: 'post',
    data: data
  })
}

// 查询运单信息详细，按月工资单ID，月工资表，关联运单显示，使用
export function listWaybillByMonthSalaryBillId(monthProfitBillId, query) {
  return request({
    url: '/waybills/waybill/monthsalarystatistic/' + monthProfitBillId,
    method: 'get',
    params: query
  })
}
